package com.laowang.project.system.controller;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.laowang.framework.aspectj.lang.annotation.Log;
import com.laowang.framework.aspectj.lang.enums.BusinessType;

import org.springframework.web.bind.annotation.*;
import com.laowang.project.system.domain.MyCyhFuli;
import com.laowang.project.system.service.MyCyhFuliService;
import com.laowang.framework.web.controller.BaseController;
import com.laowang.framework.web.domain.AjaxResult;
import com.laowang.common.utils.poi.ExcelUtil;
import com.laowang.framework.web.page.TableDataInfo;

/**
 * 福利管理Controller
 *
 * @author laowang
 * @date 2023-05-15
 */
@Api(tags = "福利管理接口")
@RestController
@RequestMapping("/fuli")
public class MyCyhFuliController extends BaseController {
    @Autowired
    private MyCyhFuliService myCyhFuliService;

    /**
     * 查询福利管理列表
     */
    @ApiOperation(value = "查询福利管理列表",notes = "")
    @PreAuthorize("@ss.hasPermi('my:fuli:list')")
    @GetMapping("/list")
        public TableDataInfo list(MyCyhFuli myCyhFuli) {
        startPage();
        List<MyCyhFuli> list = myCyhFuliService.selectMyCyhFuliList(myCyhFuli);
        return getDataTable(list);
    }

    /**
     * 导出福利管理列表
     */
    @ApiOperation(value = "导出福利管理列表",notes = "")
    @PreAuthorize("@ss.hasPermi('my:fuli:export')")
    //@Log(title = "福利管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(MyCyhFuli myCyhFuli) {
        List<MyCyhFuli> list = myCyhFuliService.selectMyCyhFuliList(myCyhFuli);
        ExcelUtil<MyCyhFuli> util = new ExcelUtil<MyCyhFuli>(MyCyhFuli.class);
        return util.exportExcel(list, "fuli");
    }

    /**
     * 获取福利管理详细信息
     */
    @ApiOperation(value = "获取福利管理详细信息",notes = "")
    @PreAuthorize("@ss.hasPermi('my:fuli:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id) {
        return AjaxResult.success(myCyhFuliService.selectMyCyhFuliById(id));
    }

    /**
     * 新增福利管理
     */
    @ApiOperation(value = "新增福利管理",notes = "")
    @PreAuthorize("@ss.hasPermi('my:fuli:add')")
    //@Log(title = "福利管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MyCyhFuli myCyhFuli) {
        return toAjax(myCyhFuliService.insertMyCyhFuli(myCyhFuli));
    }

    /**
     * 修改福利管理
     */
    @ApiOperation(value = "修改福利管理",notes = "")
    @PreAuthorize("@ss.hasPermi('my:fuli:edit')")
    //@Log(title = "福利管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MyCyhFuli myCyhFuli) {
        return toAjax(myCyhFuliService.updateMyCyhFuli(myCyhFuli));
    }

    /**
     * 删除福利管理
     */
    @ApiOperation(value = "删除福利管理",notes = "")
    @PreAuthorize("@ss.hasPermi('my:fuli:remove')")
    //@Log(title = "福利管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids) {
        return toAjax(myCyhFuliService.deleteMyCyhFuliByIds(ids));
    }
}
